import os


class Config_01(object):
    excel = '\\dataconfig\\case002.xls'
    sheet = 0  # 0 是第1个表格
    header = '\\dataconfig\\header.json'
    user = '\\dataconfig\\user.json'
    host_remine = 'http://192.168.175.131'
    host_zxyj = 'https://api.zxyjsc.com'
    report = "\\report\\"
    config_yaml = "\\dataconfig\\config.yaml"
    log_dir = "\\logs\\"


config_01 = Config_01()


class FilePath(object):


    def sheet(self):
        return config_01.sheet

    def host(self,case_id):
        if 'zxyj' in case_id:
            return config_01.host_zxyj
        elif 'redmine' in case_id:
            return config_01.host_remine
        else:
            return None

    def file_path(self,key):
        # d01 = {
        #     'excel':config_01.excel,
        #     'header':config_01.header,
        #     'user':config_01.user,
        #     'report':config_01.report,
        #     'config_yaml':config_01.config_yaml
        # }
        # res = d01[key]
        path = getattr(Config_01, key)
        dir01 = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
        path = os.path.join(dir01 + path)
        return path

    def excel(self):
        path = self.file_path('excel')
        return path
    def header(self):
        path = self.file_path('header')
        return path
    def user(self):
        path = self.file_path('user')
        return path
    def report(self):
        path = self.file_path('report')
        return path
    def config_json(self):
        return self.file_path('config_yaml')
    def log_dir(self):
        return self.file_path('log_dir')


if __name__ == '__main__':
    a01=FilePath().config_json()
    print(a01)
    pass
    # arg = '\\config\\token.json'
    # a01 = FilePath().path(arg)
    # a01 = FilePath().config_json()
    # a01 = Test01().test_method('100')
    # print(a01)
